home *** CD-ROM | disk | FTP | other *** search
- Path: fnnews.fnal.gov!usenet
- From: kriol@martian.fnal.gov (Oleg Krivosheev)
- Newsgroups: comp.lang.c++
- Subject: Re: class for accessing indiv bits
- Date: 12 Mar 1996 16:38:45 -0600
- Organization: FNAL
- Sender: kriol@martian.fnal.gov
- Message-ID: <vi8ybp60wei.fsf@martian.fnal.gov>
- References: <4h3396$l4f@oclc.org>
- NNTP-Posting-Host: martian.fnal.gov
- In-reply-to: razin@oclc.org's message of Wed, 13 Mar 1996 16:43:16 GMT
- X-Newsreader: Gnus v5.1
-
-
- Hi, Ira
-
- I was thinking about writing a class for simulating array
- of bits, where each member of that array can serve as a
- binary variable, so for example, by allocating just two
- long integers I would have an array of sizeof(long)*8
- elements.
-
- ok
-
- Having such a class would be a lot of fun.
-
- hmm... ;)
-
- Anybody have it
- implemented already? I have written basic functions for
- retrieving, setting and toggling bits, but they are very
- C-style. How about overloaded [],=, copy constructors etc
- so it looks just like a regular data type?
-
- AFAIK, the C++ DWP contains specialized version of the vector class:
- vector<bool>. In HP STL implementation the class name was changed
- to bit_vector - take a look at bvector.h. Probably commercial STL
- implementations are more close to the C++ DWP.
-
- Ira
-
- Oleg
-
-